﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class Agency_batchnumber : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
         System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAttorney);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
            showGridView();
        }
    }

    public void showGridView()
    {

        string strConditions = fctConditions();
        Db db = new Db();
        DbPage dbPage = new DbPage(db);
        dbPage.Table = "V_Account";                                               //要查询的表明

        dbPage.Key = "Accountid";                                               //表的主键    
        dbPage.Where = strConditions;                                           //查询条件    
        dbPage.SelectField = "Accountid,AccountName,DWName";//要显示的字段
        dbPage.PageIndex = SysFun.ToInt(Request["CurrentlyPageIndex"]);          //要显示第几页   
        dbPage.PageSize = 15;                                                    //没有显示记录条数   
        dbPage.OrderBy = "Accountid";                  //排序字段
        

        System.Data.IDataReader dr = dbPage.ExecuteReader();
        this.GridView1.DataSource = dr;
        this.GridView1.DataBind();
        dr.Close();
        dr.Dispose();
        dbPage.Db.Close();
        db.Close();
        this.DbPageFlip1.DbPage = dbPage;//将数据传给控键



    }
    public string fctConditions()
    {
        string strtemp = "", AccountName = "", DWName = "", Accountid = "";
        strtemp = "type='2' and";
        AccountName = this.AccountName.Text.ToString().Trim(); 
        DWName = this.DWName.Text.ToString().Trim();
        Accountid = this.Accountid.Text.ToString().Trim();
        if(Accountid!="")
        {
            strtemp+=" Accountid like '%"+Accountid+"%' and";
        }
        if (DWName != "")
        {
            strtemp += " DWName like '%" + DWName + "%'and";
        }
        if (AccountName != "")
        {
            strtemp += " AccountName like '%" + AccountName + "%' and";
        }
       strtemp=strtemp.Substring(0, strtemp.Length - 3);
        return strtemp;
   

    }
        
        


}
